<?xml version='1.0' encoding='UTF-8'?>

<ui:composition xmlns="http://www.w3.org/1999/xhtml"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:c="http://java.sun.com/jsp/jstl/core"
	xmlns:p="http://primefaces.prime.com.tr/ui"
	xmlns:a="http://java.sun.com/jsf/composite/custom"
	template="../templates/template.xhtml">
    
    <ui:define name="metadata">
		<f:event type="preRenderView" listener="#{projectDetailsPage.initProjectDetailsPage}" />
	</ui:define>
		
	<ui:define name="pageTitle">#{msg.proDetailsTitle}</ui:define>
	
	<ui:param name="proj" value="#{projectDetailsPage.project}" />

	<ui:define name="content">
		<p>#{msg.proDetailsPresentation}</p>
		
		<div class="contenu-item">
			<fieldset>
				<h:panelGrid columns="2" columnClasses="txtGras, ">
				    <h:outputText value="#{msg.proCreationNom}" />
				    <h:inputText value="#{proj.name}" required="true" />

				    <h:outputText value="#{msg.proCreationCodeCRA}" />
				    <h:inputText value="#{proj.craCode}" required="true" />

				    <h:outputText value="#{msg.dclRechercheVendu}"/>
				    <h:outputText value="#{projectDetailsPage.soldCharge}" />

				    <h:outputText value="#{msg.dclRechercheConso}" />
				    <h:outputText value="#{projectDetailsPage.charge}" />

				    <h:outputText value="#{msg.dclRechercheRAF}" />
				    <h:outputText value="#{projectDetailsPage.etc}" />

				    <h:commandButton action="#{projectDetailsPage.update}" value="#{msg.dclDetailsValider}"
						     styleClass="button"/>
				    &nbsp;
				</h:panelGrid>
			
			</fieldset>
		</div>

		<div class="contenu-item">

		    <p:panel header="#{msg.proDetailsListeDC}" toggleable="true" collapsed="true" toggleSpeed="0"
			     rendered="#{not empty projectDetailsPage.requests}">
				<ui:repeat value="#{projectDetailsPage.requests}" var="req">
				    <h:commandLink value="#{req.clientReference}" action="REQ_DETAILS">
						<f:setPropertyActionListener target="#{requestDetailsPage.clientRequest}" value="#{req}" />
				    </h:commandLink>
				    <br />
				</ui:repeat>
		    </p:panel>
		    
		</div>

		<br />

		<p:panel header="#{msg.proDetailsListTaches}" toggleable="true" collapsed="true" toggleSpeed="0"
			 styleClass="leftCleared">
		    <a:taskList tableId="tasks" value="#{projectDetailsPage.tasks}" lazy="#{false}" />
		</p:panel>

		<br />

		<p:panel header="#{msg.proDetailsRepartition}" toggleable="true" collapsed="true" toggleSpeed="0">
		    <p:pieChart value="#{projectDetailsPage.requestBeans}" var="reqBean"
				categoryField="#{reqBean.clientRequest.clientReference}" dataField="#{reqBean.charge}"
				itemSelectListener="#{projectDetailsPage.chartItemSelected}" update="chartMessage"/>

		    <p:outputPanel id="chartMessage">
				<h:outputText value="#{projectDetailsPage.chartMessage}" />
		    </p:outputPanel>
		</p:panel>
		
	</ui:define>
	
</ui:composition>